import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import DefineOptions from 'unplugin-vue-define-options/dist/vite';
import vueJsx from '@vitejs/plugin-vue-jsx';

// https://vitejs.dev/config/
export default defineConfig({
	base: './', //打包路径
  plugins: [vue(),  DefineOptions(), vueJsx()],
	resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src'),
    },
  },
	css:{
    preprocessorOptions:{
      scss:{
        additionalData:'@import "@/common/style/main.scss";'
      }
    }
  },
	//启动服务配置
  server: {
    host: 'localhost',
    port: 8000,
    open: true,
    https: false,
    proxy: {}
  },
	//去除 console debugger
  build: {
		//打包后文件目录
		outDir:"umd",
		//压缩
		minify:false,
		// 打包配置
		rollupOptions:{
			// 忽略打包vue文件
			external:["vue"],
			//input:["index.ts"],
			output:{
				globals:{
					vue: "Vue",
					dir:"dist"
				}
			},	
		},
		lib:{
				entry:"./index.ts",
				name:"easyest",
				fileName:"easyest",
				formats:["es","umd","cjs","iife"]
		}
  },
})
